/**
 * 
 */
package com.ubo.visu.painter.association;

import com.ubo.util.Duo;
import com.ubo.visu.model.ModelNode;
import com.ubo.visu.painter.UtilsSize;
import com.ubo.visu.painter.node.INodePainter;
import com.ubo.visu.util.PropertiesManager;

/**
 * @author saludegu
 * 
 */
public abstract class ALinePainter extends AAssociationPainter {

	/**
	 * 
	 * Constructor
	 * 
	 * @param painterTo
	 * @param painterFrom
	 * 
	 */
	public ALinePainter(INodePainter painterFrom, INodePainter painterTo) {
		super(painterFrom, painterTo);
	}

	/**
	 * Renvoie la position de départ de la ligne.
	 * 
	 * @param node
	 * @return
	 */
	public Duo<Integer, Integer> getPosition(INodePainter node, ModelNode nodeModel) {
		Double widthNode = PropertiesManager.getInstance().getDoubleProperty(
				PROPERTY_RECTANGLE_WIDTH);
		Double heightNode =UtilsSize.computeRectangleHeight(nodeModel);
		Number xValue = (node.getContent().getLayoutX() + (widthNode / 2));
		Number yValue = (node.getContent().getLayoutY() + (heightNode / 2));
		return new Duo<Integer, Integer>(xValue.intValue(), yValue.intValue());
	}
}
